﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace IGolovkine.ShoutCastRipper.UI.AdminPanel
{
    public class StationRipperEventItem : INotifyPropertyChanged
    {
        private DateTime _time;
        public DateTime Time
        {
            get { return this._time; }
            set { this.SetProperty(ref _time, value, "Time"); }
        }

        private string _description;
        public string Description
        {
            get { return _description; }
            set { this.SetProperty(ref _description, value, "Description"); }
        }

        private string _sourceName;
        public string SourceName
        {
            get { return _sourceName; }
            set { this.SetProperty(ref _sourceName, value, "SourceName"); }
        }

        private void SetProperty<T>(ref T field, T newValue, string propertyName)
        {
            if (!object.Equals(field, newValue))
            {
                field = newValue;
                this.OnPropertyChanged(propertyName);
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
